Defining the Viewport

After defining the view surface, it is necessary to define the portion of this surface which is to be used for plotting the graph. All lines and symbols (except for labels drawn by plbox, plmtex and pllab) are clipped at the viewport boundaries.

Viewports are created within the current subpage. If the division of the output device into equally sized subpages is inappropriate, it is best to specify only a single subpage which occupies the entire output device (by setting nx=1 and ny=1 in plbeg or plstar), and use one of the viewport specification subroutines below to place the plot in the desired position on the page.

There are two methods for specifying the viewport size, using the subroutines plvpor and plsvpa. Each of these has the format:

plvpor(xmin,xmax,ymin,ymax);
plsvpa(xmin,xmax,ymin,ymax);
where in the case of plvpor, the arguments are given in normalized subpage coordinates which are defined to run from 0.0 to 1.0 along each edge of the subpage. Thus for example,
plvpor(0.0,0.5,0.5,1.0);
uses the top left quarter of the current subpage.

In order to get a graph of known physical size, the routine plsvpa defines the viewport in terms of absolute coordinates (millimetres) measured from the bottom left-hand corner of the current subpage. This routine should only be used when the size of the view surface is known, and a definite scaling is required.

To help the user call plsvpa correctly, the routine plgspa is provided which returns the positions of the extremities of the current subpage measured in millimetres from the bottom left-hand corner of the device. Thus, if to set up a viewport with a 10.0 mm margin around it within the current subpage, the following sequence of calls may be used

plgspa(xmin,xmax,ymin,ymax);
plsvpa(10.0,xmax-xmin-10.0,10.0,ymax-ymin-10.0);
A further routine plvsta is available which sets up a standard viewport within the current subpage with suitable margins on each side of the viewport. This may be used for simple graphs, as it leaves enough room for axis labels and a title. This standard viewport is that used by plenv (see Section [*]).